function getUrlParams(data) {
    let obj = {};
    let arr = data.slice(1, data.length).split('&');
    //遍历数组
    arr.forEach(function (val) {
        //切割=两边的数据
        let arr1 = val.split('=');
        obj[arr1[0]] = arr1[1];
    })
    return obj;
}

function urlParam(url) {
    if (url.indexOf("#") !== -1) {
        console.log("url里带#");
        let param = window.location.hash;
        return getUrlParams(param);
    } else if (url.indexOf("?") !== -1) {
        console.log("url里带?");
        let param = window.location.search;
        return getUrlParams(param);
    } else {
        console.log("不带参！");
    }
}